/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kmcsoft.goldshop.model.exchange;

import com.kmcsoft.emaster.entity.TrackableEntity;
import com.kmcsoft.goldshop.model.master.Currency;
import com.kmcsoft.goldshop.model.master.PremiumJewelryType;
import com.kmcsoft.goldshop.model.master.Unit;
import javax.jdo.annotations.Column;
import javax.jdo.annotations.FetchGroup;
import javax.jdo.annotations.FetchGroups;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

/**
 *
 * @author huyvu
 */
@PersistenceCapable(detachable = "true", table = "shop_JewelryExchangeDetail")
@FetchGroups(value = {
    @FetchGroup(name = "detach_JewelryExchangeDetail_All", members = {
        @Persistent(name = "jewelryType"),
        @Persistent(name = "unit"),
        @Persistent(name = "currency")}),
    @FetchGroup(name = "detach_JewelryExchangeDetail_PremiumJewelryType", members = {
        @Persistent(name = "jewelryType")}),
    @FetchGroup(name = "detach_JewelryExchangeDetail_Unit", members = {
        @Persistent(name = "unit")}),
    @FetchGroup(name = "detach_JewelryExchangeDetail_Currency", members = {
        @Persistent(name = "currency")})
})
public class JewelryExchangeDetail extends TrackableEntity {

    @Persistent
    @Column(defaultValue = "0")
    private double sellingPrice;
    @Persistent
    private PremiumJewelryType jewelryType;
    @Persistent
    private Unit unit;
    @Persistent
    private Currency currency;

    public JewelryExchangeDetail(PremiumJewelryType jewelryType) {
        this.jewelryType = jewelryType;
        this.currency = jewelryType.getCurrency();
        this.sellingPrice = jewelryType.getUnitPrice();
        this.unit=jewelryType.getUnit();
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    public PremiumJewelryType getJewelryType() {
        return jewelryType;
    }

    public void setJewelryType(PremiumJewelryType jewelryType) {
        this.jewelryType = jewelryType;
    }

    public double getSellingPrice() {
        return sellingPrice;
    }

    public void setSellingPrice(double sellingPrice) {
        this.sellingPrice = sellingPrice;
    }

    public Unit getUnit() {
        return unit;
    }

    public void setUnit(Unit unit) {
        this.unit = unit;
    }
}
